package quanlithpt;
/**
 *
 * @author codercui
 */
public final class hoc_sinh extends javax.swing.JFrame {
    String taikhoan;
    SQL a=new SQL();
    public hoc_sinh() {
        this.setLocation(250, 100);
        initComponents();
    }
    public hoc_sinh(String tk) {
        this.setLocation(250, 100);
        taikhoan=tk;
        initComponents();
        this.dien_ttin(tk);
    }
    public void dien_ttin(String tk){
   // lấy họ tên
        String hten=a.select("ho_hs", "hoc_sinh","where ten_dn= '"+tk+"'")+" "+ //họ tên lót
                    a.select("ten_hs", "hoc_sinh","where ten_dn= '"+tk+"'"); // tên
        lbl_hten.setText("Họ tên: "+hten);
   // lấy lớp 
        String ma_lop=a.select("ms_l", "hoc_sinh","where ten_dn= '"+tk+"'");  //lấy mã lớp
        String ten_lop=a.select("ten_lop", "lop","where ms_l= '"+ma_lop+"'");  //lấy tên lớp
        lbl_lop.setText("Học lớp: "+ten_lop);
        
   // lấy ngày tháng năm sinh     
        String nsinh=a.select("sinh_nhat", "hoc_sinh", "where ten_dn= '"+tk+"'");
        String ntnsinh= ham_hotro.xu_lyngay(nsinh);
        lbl_nsinh.setText("Năm sinh: "+ntnsinh);
   //giới tính      
        String gtinh=a.select("gioi_tinh", "hoc_sinh", "where ten_dn= '"+tk+"'");
        lbl_gtinh.setText("Giới tính: "+(gtinh.equals("0")? "Nữ":"Nam"));
   // lấy tên phụ huynh
        String ma_ph=a.select("ms_ph", "hoc_sinh","where ten_dn= '"+tk+"'");  //lấy mã phụ huynh
        String ho_ph=a.select("ho_ph", "phu_huynh","where ms_ph= '"+ma_ph+"'");  //lấy họ tên lót phụ huynh
        String ten_ph=a.select("ten_ph","phu_huynh","where ms_ph= '"+ma_ph+"'");  //lấy tên phụ huynh
        lbl_phuynh.setText("Tên phụ huynh:  "+ho_ph+" "+ten_ph);
        
   // địa chỉ     
        String diachi=a.select("dia_chi", "hoc_sinh", "where ten_dn= '"+tk+"'");
        lbl_dchi.setText("Địa chỉ: "+diachi);
  
   // tình trạng học phí
        String hoc_phi=a.select("hoc_phi", "hoc_sinh", "where ten_dn= '"+tk+"'");
        lbl_hphi.setText("Học phí : "+(hoc_phi.equals("0")? "Chưa đóng":"Đã đóng đủ")); // "0" đã đóng, "1" chưa đóng
   //số ngày vắng
        String nvang=a.select("ngay_vang", "hoc_sinh", "where ten_dn= '"+tk+"'");
        lbl_nvang.setText("Số ngày vắng học: "+nvang);
 // thông tin tài khoản
        lbl_tdn.setText("Tên đăng nhập: "+tk);
        
        String mail=a.select("email", "tai_khoan", "where ten_dn= '"+tk+"'");
        lbl_email.setText("Email: "+mail);
    }
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        task_ttcn = new org.jdesktop.swingx.JXTaskPane();
        lbl_hten = new javax.swing.JLabel();
        lbl_lop = new javax.swing.JLabel();
        lbl_nsinh = new javax.swing.JLabel();
        lbl_gtinh = new javax.swing.JLabel();
        lbl_phuynh = new javax.swing.JLabel();
        lbl_dchi = new javax.swing.JLabel();
        lbl_hphi = new javax.swing.JLabel();
        lbl_nvang = new javax.swing.JLabel();
        task_tttk = new org.jdesktop.swingx.JXTaskPane();
        lbl_tdn = new javax.swing.JLabel();
        lbl_email = new javax.swing.JLabel();
        btn_exit = new org.jdesktop.swingx.JXButton();
        jXButton2 = new org.jdesktop.swingx.JXButton();
        jXButton3 = new org.jdesktop.swingx.JXButton();
        hinh_hs = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jXButton4 = new org.jdesktop.swingx.JXButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Học Sinh "); 
        setResizable(false);

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setBorder(new org.jdesktop.swingx.border.IconBorder());

        String ten_hinh;
        ten_hinh=a.select("ten_hinh", "hoc_sinh","Where ten_dn = '"+taikhoan+"'");
        if(ten_hinh.equals("")){
            ten_hinh="no_avatar.jpg";
        }
        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/hoc_sinh/"+ten_hinh)));
        jLabel2.setBorder(new org.jdesktop.swingx.border.DropShadowBorder());

        jPanel1.setBackground(new java.awt.Color(0, 204, 255));

        task_ttcn.setTitle("THÔNG TIN CÁ NHÂN");
        org.jdesktop.swingx.VerticalLayout verticalLayout6 = new org.jdesktop.swingx.VerticalLayout();
        verticalLayout6.setGap(2);
        task_ttcn.getContentPane().setLayout(verticalLayout6);

        lbl_hten.setBackground(new java.awt.Color(0, 0, 0));
        lbl_hten.setFont(new java.awt.Font("Verdana", 1, 11)); // NOI18N
        lbl_hten.setForeground(new java.awt.Color(255, 51, 0));
        lbl_hten.setText("hten");
        task_ttcn.getContentPane().add(lbl_hten);

        lbl_lop.setBackground(new java.awt.Color(0, 0, 0));
        lbl_lop.setFont(new java.awt.Font("Verdana", 1, 11)); // NOI18N
        lbl_lop.setForeground(new java.awt.Color(255, 51, 0));
        lbl_lop.setText("lop");
        task_ttcn.getContentPane().add(lbl_lop);

        lbl_nsinh.setBackground(new java.awt.Color(0, 0, 0));
        lbl_nsinh.setFont(new java.awt.Font("Verdana", 1, 11)); // NOI18N
        lbl_nsinh.setForeground(new java.awt.Color(255, 51, 0));
        lbl_nsinh.setText("nsinh");
        task_ttcn.getContentPane().add(lbl_nsinh);

        lbl_gtinh.setBackground(new java.awt.Color(0, 0, 0));
        lbl_gtinh.setFont(new java.awt.Font("Verdana", 1, 11)); // NOI18N
        lbl_gtinh.setForeground(new java.awt.Color(255, 51, 0));
        lbl_gtinh.setText("gtinh");
        task_ttcn.getContentPane().add(lbl_gtinh);

        lbl_phuynh.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lbl_phuynh.setForeground(new java.awt.Color(255, 51, 0));
        lbl_phuynh.setText("phuynh");
        task_ttcn.getContentPane().add(lbl_phuynh);

        lbl_dchi.setBackground(new java.awt.Color(0, 0, 0));
        lbl_dchi.setFont(new java.awt.Font("Verdana", 1, 11)); // NOI18N
        lbl_dchi.setForeground(new java.awt.Color(255, 51, 0));
        lbl_dchi.setText("dchi");
        task_ttcn.getContentPane().add(lbl_dchi);

        lbl_hphi.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lbl_hphi.setForeground(new java.awt.Color(255, 51, 0));
        lbl_hphi.setText("hphi");
        task_ttcn.getContentPane().add(lbl_hphi);

        lbl_nvang.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lbl_nvang.setForeground(new java.awt.Color(255, 51, 0));
        lbl_nvang.setText("nvang");
        task_ttcn.getContentPane().add(lbl_nvang);

        task_tttk.setTitle("THÔNG TIN TÀI KHOẢN");
        org.jdesktop.swingx.VerticalLayout verticalLayout7 = new org.jdesktop.swingx.VerticalLayout();
        verticalLayout7.setGap(2);
        task_tttk.getContentPane().setLayout(verticalLayout7);

        lbl_tdn.setBackground(new java.awt.Color(0, 0, 0));
        lbl_tdn.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lbl_tdn.setForeground(new java.awt.Color(255, 51, 0));
        lbl_tdn.setText("tdn");
        task_tttk.getContentPane().add(lbl_tdn);

        lbl_email.setBackground(new java.awt.Color(0, 0, 0));
        lbl_email.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lbl_email.setForeground(new java.awt.Color(255, 51, 0));
        lbl_email.setText("email");
        task_tttk.getContentPane().add(lbl_email);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(task_ttcn, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(task_tttk, javax.swing.GroupLayout.DEFAULT_SIZE, 195, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(task_ttcn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(task_tttk, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(21, Short.MAX_VALUE))
        );

        btn_exit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/48x48/exit.png"))); // NOI18N
        btn_exit.setText("Thoát");
        btn_exit.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btn_exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_exitActionPerformed(evt);
            }
        });

        jXButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/48x48/kqht.png"))); // NOI18N
        jXButton2.setText("Xem điểm");
        jXButton2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N

        jXButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/48x48/thong_bao.png"))); // NOI18N
        jXButton3.setText("Thông báo");
        jXButton3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N

        hinh_hs.setBackground(new java.awt.Color(255, 255, 255));
        hinh_hs.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/library book logo.jpg"))); // NOI18N

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(0, 0, 204));
        jLabel1.setText("TRƯỜNG TRUNG HỌC PHỔ THÔNG PHẠM HÙNG");

        jXButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/48x48/tkb.png"))); // NOI18N
        jXButton4.setText("Thời Khóa biểu");
        jXButton4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(76, 76, 76)
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(hinh_hs)
                .addGap(56, 56, 56))
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(26, 26, 26)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jXButton4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jXButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jXButton3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(btn_exit, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(67, 67, 67)
                        .addComponent(jLabel1)))
                .addContainerGap(67, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 61, Short.MAX_VALUE)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(hinh_hs, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel2)
                        .addGap(11, 11, 11)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jXButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jXButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(11, 11, 11)
                        .addComponent(jXButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btn_exit, javax.swing.GroupLayout.PREFERRED_SIZE, 62, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(20, 20, 20))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btn_exitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_exitActionPerformed
        this.setVisible(false);
       dang_nhap dangnhap=new dang_nhap();
       dangnhap.setVisible(true);
    }//GEN-LAST:event_btn_exitActionPerformed
    public static void main(String args[]) {
        final hoc_sinh a=new hoc_sinh();
        a.dien_ttin(a.taikhoan);
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Windows".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(hoc_sinh.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(hoc_sinh.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(hoc_sinh.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(hoc_sinh.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        java.awt.EventQueue.invokeLater(new Runnable() {

            @Override
            public void run() {
            //   quan_tri a=new quan_tri();
               a.setVisible(true);
            //    a.dien_ttin();
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private org.jdesktop.swingx.JXButton btn_exit;
    private javax.swing.JLabel hinh_hs;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private org.jdesktop.swingx.JXButton jXButton2;
    private org.jdesktop.swingx.JXButton jXButton3;
    private org.jdesktop.swingx.JXButton jXButton4;
    private javax.swing.JLabel lbl_dchi;
    private javax.swing.JLabel lbl_email;
    private javax.swing.JLabel lbl_gtinh;
    private javax.swing.JLabel lbl_hphi;
    private javax.swing.JLabel lbl_hten;
    private javax.swing.JLabel lbl_lop;
    private javax.swing.JLabel lbl_nsinh;
    private javax.swing.JLabel lbl_nvang;
    private javax.swing.JLabel lbl_phuynh;
    private javax.swing.JLabel lbl_tdn;
    private org.jdesktop.swingx.JXTaskPane task_ttcn;
    private org.jdesktop.swingx.JXTaskPane task_tttk;
    // End of variables declaration//GEN-END:variables
}
